#|bin/bash
## 将文件结尾从CRLF改为LF，解决了cd 错误问题
time=$(date "+%Y-%m-%d-%H-%M-%S")
origin_dir='oomall-testreport'
daily_dir='daily-report/'$time
echo $daily_dir

echo '-------------------initializing oomall database-------------------------'
cd /home/mybro/ooad2-4/sql
mysql -h localhost -udbuser -p12345678 -D oomall < goods-batch.sql

cd /home/mybro/ooad2-4
git checkout aftersales/pom.xml
git checkout customer/pom.xml
git checkout liquidation/pom.xml
git checkout share/pom.xml
git pull

echo '-------------------building aftersales-------------------------'
cd /home/mybro/ooad2-4/aftersales
sed -i 's#'''$origin_dir'''#'''$daily_dir'''#g' pom.xml
mvn clean install
mvn site:site site:deploy

echo '-------------------building customer-------------------------'
cd /home/mybro/ooad2-4/customer
sed -i 's#'''$origin_dir'''#'''$daily_dir'''#g' pom.xml
mvn clean test
mvn site:site site:deploy

echo '-------------------building liquidation-------------------------'
cd /home/mybro/ooad2-4/liquidation
sed -i 's#'''$origin_dir'''#'''$daily_dir'''#g' pom.xml
mvn clean test
mvn site:site site:deploy

echo '-------------------building share-------------------------'
cd /home/mybro/ooad2-4/share
sed -i 's#'''$origin_dir'''#'''$daily_dir'''#g' pom.xml
mvn clean test
mvn site:site site:deploy

#echo '-------------------initializing privilege database-------------------------'
#cd /home/mybro/privilegegateway/sql
#mysql -h localhost -udbuser -p12345678 -D privilege_gateway < privilegegateway-batch.sql
#
#cd /home/mybro/privilegegateway
#git checkout annotation/pom.xml
#git checkout privilegeservice/pom.xml
#git pull
#echo '-------------------building annotation-------------------------'
#cd /home/mybro/privilegegateway/annotation
#sed -i 's#'''$origin_dir'''#'''$daily_dir'''#g' pom.xml
#mvn clean install
#mvn site:site site:deploy
#
#echo '-------------------building comment-------------------------'
#cd /home/mybro/privilegegateway/privilegeservice
#git checkout pom.xml
#sed -i 's#'''$origin_dir'''#'''$daily_dir'''#g' pom.xml
#mvn clean test
#mvn site:site site:deploy

# curl --user ooad_javaee:12345678 -T /home/mybro/logs/daily_test.log http://172.16.4.1/webdav/daily-report/$time/console.log

